package com.itheima;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/*@SpringBootApplication
@EnableEurekaClient //申明是一个eureka客户端
@EnableCircuitBreaker //开启熔断器的支持*/
/*
    都是用于将服务注册至注册中心
    @EnableDiscoveryClient: 可以用于eureka注册中心，也可以用于其他注册中心: zk
    @EnableEurekaClient: 专用于eureka注册中心，如果更换其他的注册中心则不可使用
 */
@SpringCloudApplication //组合注解 =SpringBootApplication+EnableEurekaClient+EnableCircuitBreaker
@EnableHystrixDashboard //开启图形化界面支持
public class ConsumerServiceApplication {

    public static void main(String[] args) {
        SpringApplication.run(ConsumerServiceApplication.class, args);
    }
    @Bean
    @LoadBalanced //使用ribbon进行负载
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }
}
